<?php
namespace PsiFramework\Classes\Util\Database\Query;

import("Classes.Util.Database.Query.SqlParameter");
import("Classes.Util.Database.Query.SqlTable");
import("Classes.Util.Database.Query.SqlType");

use \PsiFramework\Classes\Util\Database\Query\SqlParameter;
use \PsiFramework\Classes\Util\Database\Query\SqlTable;
use \PsiFramework\Classes\Util\Database\Query\SqlType;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The SqlColumn class is a SqlParameter which
 * allows to represent a column of a Sql table
 *
 * @package classes.util.xpersist.sql
 */
class SqlColumn extends SqlParameter
{

    protected /*string*/   $_name ;
    protected /*SqlTable*/ $_table ;
    protected /*SqlType*/  $_type ;
    protected /*string*/   $_alias = null ;
    protected /*string*/   $_newOld = null ;

    /**
     * SqlColumn constructor
     *
     * @param $name        the name of the column
     * @param $table    the SqlTable the column belongs to
     * @param $type        the SqlType the column has
     * @param $alias    the alias of the column
     */
    public function __construct(
        /*string*/ $name,
        SqlTable   $table=null,
        SqlType    $type=null,
        /*string*/ $alias=null,
        /*string*/ $newOld=null
    )
    {

        $this->_name = $name ;
        $this->_table = $table ;
        $this->_type = $type ;
        $this->_alias = $alias ;
        $this->_newOld = $newOld ;

    }

    /**
     * Setter for the member variable $table
     *
     * @param $table
     */
    public function setTable(SqlTable $table)
    {
        $this->_table = $table ;
    }

    /**
     * Getter for the member variable $name
     *
     * @return string
     */
    public function getName()
    {
        return $this->_name ;
    }

    /**
     * Getter for the member variable $table
     *
     * @return SqlTable
     */
    public function getTable()
    {
        return $this->_table ;
    }

    /**
     * Setter for the member variable $alias
     *
     * @param $alias
     */
    public function setAlias(/*string*/ $alias)
    {
        $this->_alias = $alias ;
    }

    /**
     * Getter for the member variable $alias
     *
     * @return string
     */
    public function getAlias()
    {
        return $this->_alias ;
    }

    /**
     * Setter for the member variable $type
     *
     * @param $type
     */
    public function setType(SqlType $type)
    {
        $this->_type = $type ;
    }

    /**
     * Getter for the member variable $type
     *
     * @return SqlType
     */
    public function getType()
    {
        return $this->_type ;
    }

    /**
     * Setter for the member variable $newOld
     *
     * @param $newOld
     */
    public function setNewOld(/*string*/ $newOld)
    {
        $this->_newOld = $newOld ;
    }

    /**
     * Getter for the member variable $newOld
     *
     * @return string
     */
    public function getNewOld()
    {
        return $this->_newOld ;
    }

}

